package com.geetour.columbus.region.dao.impl;

import java.util.List;

import com.geetour.columbus.common.exceptions.DAOException;
import com.geetour.columbus.common.model.R.AreaPage;
import com.geetour.columbus.core.ibatis.SqlMapClientDaoSupportEx;
import com.geetour.columbus.region.dao.IAreaPageDAO;

public class AreaPageDAOImpl extends SqlMapClientDaoSupportEx implements IAreaPageDAO {

    @Override
    public void insertAreaPage(AreaPage area) throws DAOException {
        if (area == null) {
            return;
        }
        this.insert("insertAreaPage", area);
    }

    @Override
    public int insertAreaPageBatch(List<AreaPage> areaList) throws DAOException {
        if (areaList == null || areaList.isEmpty()) {
            return -1;
        }
        return this.insert("insertAreaPage", areaList);
    }

    @Override
    public int updateAreaPageById(AreaPage area) throws DAOException {
        if (area == null) {
            return -1;
        }
        return this.update("updateAreaPage", area);
    }

    @Override
    public int updateAreaPage(AreaPage area) throws DAOException {
        if (area == null) {
            return -1;
        }
        return this.update("updateAreaPage", area);
    }

    @Override
    public int deleteAreaPageById(Long id) throws DAOException {
        if (id == null) {
            return -1;
        }
        return this.delete("deleteAreaPageById", id);
    }

    @Override
    public AreaPage findAreaPageById(Long id) throws DAOException {
        if (id == null) {
            return null;
        }
        return (AreaPage) this.queryObject("findAreaPageById", id);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<AreaPage> findAllAreaPages() throws DAOException {
        return (List<AreaPage>) this.queryList("findAllAreaPages", null);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<AreaPage> findAreaPages(AreaPage area) throws DAOException {
        if (area == null) {
            return null;
        }
        return (List<AreaPage>) this.queryList("findAreaPages", area);
    }

}
